'''
Created on 2011-3-9

@author: Shek
Name: CloseUpMaker
Version:Ver0
'''
import Image
def transf(Minrate):
    w2=w*Minrate/100
    h2=h*Minrate/100
    x1=(img_w-w2)/2
    y1=(img_h-h2)/2
    x2=(img_w+w2)/2
    y2=(img_h+h2)/2
    nimg=img.crop((x1,y1,x2,y2))
    nimg=nimg.resize((w,h))
    nimg = nimg.convert('RGB')
    nimg.save('newsVer0.jpg')
    
img=Image.open('C:\\Python27\\1234.gif')
img_w,img_h=img.size
print (img_w,' ',img_h)
w=img_w
h=img_h
while w>=img_w:
    w=input("With=?")
    if w>=img_w:
        print ("With is over ",img_w,"Please input again/n")
while h>=img_h:
    h=input("High=?")
    if h>=img_h:
        print ("High is over",img_h,"Please input again/n")       
hrate=img_h*100/h
wrate=img_w*100/w
transf(min(hrate,wrate))
